import {Component, OnInit} from '@angular/core';
import {DataService} from "../data_service";
import {HttpClient} from "@angular/common/http";

@Component({
  selector: 'app-booklist',
  templateUrl: './booklist.component.html',
  styleUrls: ['./booklist.component.css']
})
export class BooklistComponent implements OnInit {
  books: any = []
  tip="Client Dashboard"
  categorys:any=[]

  constructor(public http: HttpClient, public service: DataService) {
  }

  ngOnInit(): void {
    this.getAllRecord();
    this.getCategorys();
  }


  // getRecord() {
  //   this.service.getData(this.book_ID).subscribe();
  // }

  getAllRecord(category='') {
    this.service.getAllData(category).subscribe(resp => {
      this.books = resp
    });
  }
  getCategorys() {
    this.service.getCategorys().subscribe(resp => {
      this.categorys = resp
    });
  }

}
